<!DOCTYPE html>
<html lang="en">
<head> 
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.5,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no, email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <!-- 删除苹果默认的工具栏和菜单栏 -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <!-- 设置苹果工具栏颜色 -->
    <meta name="format-detection" content="telphone=no, email=no" />
    <!-- 忽略页面中的数字识别为电话，忽略email识别 -->
    <!-- 启用360浏览器的极速模式(webkit) --> 
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
    <meta name="HandheldFriendly" content="true">
    <!-- 微软的老式浏览器 -->
    <meta name="MobileOptimized" content="320">
    <!-- uc强制竖屏 --> 
    <meta name="screen-orientation" content="portrait">
    <!-- QQ强制竖屏 -->
    <meta name="x5-orientation" content="portrait">
    <!-- UC强制全屏 -->
    <meta name="full-screen" content="yes">
    <!-- QQ强制全屏 -->
    <meta name="x5-fullscreen" content="true">
    <!-- UC应用模式 -->
    <meta name="browsermode" content="application">
    <!-- QQ应用模式 -->
    <meta name="x5-page-mode" content="app">
    <!-- windows phone 点击无高光 -->
    <meta name="msapplication-tap-highlight" content="no">
    <title>工单管理</title>
    <link rel="stylesheet" href="{{asset('css/reset.css')}}">
    <link rel="stylesheet" href="{{asset('css/main.css')}}">
    <link rel="stylesheet" href="{{asset('css/index.css')}}">
    <link rel="stylesheet" href="{{asset('css/LCalendar.css')}}">
    <link rel="stylesheet" href="{{asset('css/yd_rl.css')}}" />
</head>
<body> 
    <!-- 公共头部 -->
    <div class="g2_head-bg">
        <!-- 返回上一层 -->
        <p class="g2_head_goback-bg fl">
            <!-- <a href="javascript:history.back(-1)"> 跳回前一步操作 -->
            <a href="javascript:history.back(-1)">
                <img src="images/xky_icon0-1.png" class="g2_head_goback_icon fl" alt="">
                <span class="g2_head_goback_del fl">返回</span>
            </a>
        </p>
        <p class="ym-tit fl">工单列表</p>
        <span class="g2_head_goback_del fr khxz_color">新增</span>
        <span class="g2_head_goback_del fr gdlb_sx" style="display:block;">筛选</span>
        <div class="cl"></div> 
    </div>
    <div class="g2_head-bg2"></div>
     <!-- 工单列表筛选 -->
    <div class="gdlb_sx-bg" id="gdgl2">
        <form action="{{url('order/chaxun')}}" method="post" id="formid">
            {{ csrf_field() }}
            <input type="hidden" id="shuliang" name="shuliang" value="{{$shuliang}}">
            <ul class="khs2">
                <li class="khs2_list">
                    <p class="khs2_tit fl">部门</p>
                    <span class="sewv fl" id="myDiv1">
                        <span class="sewvtop">
                            <!-- <span name="type">请选择旅游类型</span> -->
                            <input type="text" name="bumen" id="bumen" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择部门">
                            <em>
                                <img src="{{asset('images/xky_icon9.png')}}">
                            </em>
                        </span>
                        <ul class="sewvbm">
                            <li>请选择部门</li>
                            @foreach($bumen as $vo)
                                <li>{{$vo->name}}</li> 
                            @endforeach
                        </ul>
                    </span>
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">员工</p>
                    <input type="text" name="yuangong" class="khs2_del fl" placeholder="请填写员工姓名" value="">
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">客户姓名</p>
                    <input type="text" name="customer" class="khs2_del fl" placeholder="请填写客户姓名" value="">
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">旅游类型</p>
                    <span class="sewv fl" id="myDiv1">
                        <span class="sewvtop">
                            <!-- <span name="type">请选择旅游类型</span> -->
                            <input type="text" id='lvyouleixing' name="type" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择旅游类型">
                            <em>
                                <img src="images/xky_icon9.png">
                            </em>
                        </span>
                        <ul class="sewvbm">
                            <li>请选择旅游类型</li>
                            @foreach($type as $vo)
                                <li>{{$vo->title}}</li>
                            @endforeach
                        </ul>
                    </span>
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">旅游地点</p>
                    <span class="sewv fl" id="myDiv1">
                        <span class="sewvtop">
                            <!-- <span>请选择旅游地点</span> -->
                            <input type="text" class="lvyd2" id="didian" name="didian" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择旅游地点">
                            <em> 
                                <img src="images/xky_icon9.png">
                            </em>
                        </span>
                        <ul class="sewvbm search_content" id="lvyoudidian">
                           
                        </ul>
                    </span>
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">标签</p>
                    <span class="sewv fl" id="myDiv1">
                        <span class="sewvtop">
                            <!-- <span>请选择标签</span> -->
                            <input type="text" name="biaoqian" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择标签">
                            <em>
                                <img src="images/xky_icon9.png">
                            </em>
                        </span>
                        <ul class="sewvbm">
                            @foreach($biaoqian as $vo)
                                <li>{{$vo->name}}</li>
                            @endforeach
                        </ul>
                    </span>
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">录入时间</p>
                    <p class="khs2_del fl" style="position:relative;">
                        <input type="text" name="start_date" id="start_date" placeholder="开始日期" readonly="readonly" style="border:1px solid #999;border-radius:4px;width:48%;left:0;top:20px;height:50px;text-align:center;" />
                        <!-- <input type="text" name="start_date" id="start_date" placeholder="开始日期" readonly="readonly" style="border:1px solid #999;border-radius:4px;width:40%;right:0;top:20px;height:50px;text-align:center;"
                        /> -->
                        <input type="text" name="end_date" id="end_date" placeholder="结束日期" readonly="readonly" style="border:1px solid #999;border-radius:4px;width:48%;right:0;top:20px;height:50px;text-align:center;" />
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">状态</p>
                    <span class="sewv fl">
                        <span class="sewvtop" id="myDiv1">
                            <!-- <span>请选择状态类型</span> -->
                            <input type="text" name="zhuangtai" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择状态类型">
                            <em>
                                <img src="images/xky_icon9.png">
                            </em>
                        </span>
                        <ul class="sewvbm">
                            <li>意向单</li>
                            <li>成交单</li>
                        </ul>
                    </span>
                    <div class="cl"></div>
                </li>
                <input type="button" class="gdsx_search-btn" value="搜索">
            </ul>
        </form>
    </div>
    <!-- 工单列表 -->
    <div class="gdlb-bg" id="gdgl1">
            <ul class="gdlb" style="margin-bottom:2vw;" id="orderlist">
                @foreach($list as $vo)
                <li class="gdlb_list gdlb_cjd">
                    <a href="{{url('chengjiao')}}/{{$vo->id}}">
                        <p class="gdlb_tite">
                            <span class="gdlb_username fl">{{$vo->customer}}</span>
                            <span class="gd_cjhs fr">{{$vo->tai}}</span> 
                            <span class="gd_cjzt fr">{{$vo->dan}}</span>
                            <div class="cl"></div>
                        </p>
                        <p class="gdlb_lylx">{{$vo->type}}</p>
                        <p class="gdlb_xq">
                            <span class="gblb_xq1 fl">
                                <span>录入时间:</span>
                                <span class="gdlb_date">{{$vo->order_orderdate}}</span>
                                <span class="gdlb_place"> (<span>{{$vo->didian}}</span>)</span>
                            </span>
                            <span class="gdlb_bq fr">{{$vo->biaoqian}}</span>
                            <div class="cl"></div>
                        </p>
                    </a>
                </li>
                @endforeach
            </ul>
            <!-- 加载更多按钮 -->
            <div class="jzmore-bg" style="margin-bottom:22vw;" id="jiazai">
                <img src="{{asset('images/jiazai.png')}}" alt="">
                <span>加载更多</span>
            </div>
            <a href="{{url('xiadan')}}">
                <input type="button" class="gdlb_xd-btn" value="下单">
            </a>
    </div>

    <!-- 遮罩 -->
    <!-- loading 小圆圈 -->
    <div class="z2_loading-bg" style="width:100%;height:100%;background:rgba(255,255,255,0.6);position:fixed;;left:0;top:0;">
        <img src="{{asset('images/loading1.gif')}}" style="width:10%;position:fixed;left:0;right:0;top:0;bottom:0;margin:auto;" alt="">
    </div>
    <!-- loadning对号 -->
    <div class="duihao" style="width:100%;height:100%;position:fixed;;left:0;top:0;display:none;">
        <img src="{{asset('images/duihao.png')}}" style="width:10%;position:fixed;left:0;right:0;top:0;bottom:0;margin:auto;" alt="">
    </div>
    <!-- 下拉框遮罩-->
    <div class="xlz2-bg" style="width:100%;height:100%;position:fixed;left:0;top:0;background:transparent;z-index:-1;"></div>

    <script src="{{asset('js/jquery.min.js')}}"></script>
    <script src="{{asset('js/fastclick.min.js')}}"></script>
</body>
    <script src="{{asset('js/LCalendar.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('js/index.js')}}" type="text/javascript" charset="utf-8"></script>
    <script>
        $(function () {
            FastClick.attach(document.body);
        }); 
        $(function(){  
            $("#didian").click(function(){
                var lvyouleixing=$("#lvyouleixing").val();
                $.ajax({
                    url:"{{url('lvyouleixing')}}",
                    type:'get', //GET
                    async:false,    //或false,是否异步
                    data:{'lvyouleixing':lvyouleixing},
                    dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                    success:function(data){ 
                        var html="<li>请选择旅游地点<\/li>";
                        $.each(data,function(i,item){
                            html+="<li>"+item+"</li>";
                    　　});
                        $("#lvyoudidian").html(html);
                        $("#lvyoudidian li").click(function(){
                            // alert($(this).html())
                            $("#didian").val($(this).html());
                            $("#lvyoudidian").css('display','none');
                        })
                    }, 
                })
            }); 
        })
        window.onload = function (event) {
            location.hash = 'gdgl1';
            $("#gdgl1").show();
            $("#gdgl2").hide();
            $(".z2_loading-bg").hide();
        }

        $(window).on('hashchange', function (e) {
            var id = location.hash.substr(1);
            $("#" + id).show()

            if (id == "gdgl1") {
                $("#gdgl1").show();
                $("#gdgl2").hide();
                $('.ym-tit').html('工单列表');
            } else if (id == "gdgl2") {
                $("#gdgl2").show();
                $("#gdgl1").hide();
                $('.ym-tit').html('工单列表筛选');
            }

        })
        // 工单列表点击出现筛选
        $('.gdlb_sx').click(function () {
            $(document).scrollTop(0);
            location.hash = 'gdgl2';
            $("#gdgl2").show();
            $("#gdgl1").hide();
            $('.ym-tit').html('工单列表筛选');
        })
        // 工单列表筛选结束
        $('.gdsx_search-btn').click(function () {
            var d = {};
            var t = $('#formid').serializeArray();
            $.each(t, function() {
              d[this.name] = this.value;
            });
            var data=JSON.stringify(d);
            $.ajax({
                url:"{{url('order/chaxun')}}",
                type:'post', //GET
                async:false,    //或false,是否异步
                data:{'_token':'{{csrf_token()}}','data':data},
                dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                beforeSend:function(){
                    console.log('发送前');
                    $('.z2_loading-bg').show();
                },
                success:function(data){
                    var html="";
                    if(data=="false"){
                        location.reload(); 
                    }else{
                        $.each(data.order,function(i,item){
                            html+="<li class=\"gdlb_list gdlb_cjd\"><a href=\"jjj\"><p class=\"gdlb_tite\"><span class=\"gdlb_username fl\">"+item.customer+"<\/span><span class=\"gd_cjhs fr\">"+item.tai+"<\/span><span class=\"gd_cjzt fr\">"+item.dan+"<\/span><div class=\"cl\"><\/div><\/p><p class=\"gdlb_lylx\">"+item.type+"<\/p><p class=\"gdlb_xq\"><span>录入时间:<\/span><span class=\"gdlb_date\">"+item.order_orderdate+"<\/span><span class=\"gdlb_place\"> (<span>"+item.didian+"<\/span>)<\/span><span class=\"gdlb_bq fr\">"+item.biaoqian+"<\/span><div class=\"cl\"><\/div><\/p><\/a><\/li>";
                    　　});
                        $("#shuliang").val(data.shuliang);
                        $("#orderlist").html(html);
                    }
                }, 
                complete:function(){
                    // window.location.reload();//刷新頁面
                    location.hash = 'gdgl1';
                    $("#gdgl1").show();
                    $("#gdgl2").hide();
                    $('.ym-tit').html('工单列表');
                    $('.z2_loading-bg').hide();
                    // $('.duihao').show();
                    // $('.duihao').hide(1000);
                }
            })
        })

    </script>
    <script type="text/javascript">
        var calendar = new LCalendar();
        calendar.init({
            'trigger': '#start_date', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
            'minDate': (new Date().getFullYear() - 3) + '-' + 1 + '-' + 1, //最小日期
            'maxDate': (new Date().getFullYear() + 3) + '-' + 12 + '-' + 31 //最大日期
        });

        var calendar = new LCalendar();
        calendar.init({
            'trigger': '#end_date', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
            'minDate': (new Date().getFullYear() - 3) + '-' + 1 + '-' + 1, //最小日期
            'maxDate': (new Date().getFullYear() + 3) + '-' + 12 + '-' + 31 //最大日期
        });
        // 模糊搜索
        $(function () {
            var search_input = $(".lvyd2"),
                search_content = $(".search_content");
            $(search_input).on("keyup", function () {
                if (search_input.val() == '') {
                    $(search_content).show();
                }
                $(".search_content li:contains(" + search_input.val().trim() + ")").show();
                $(".search_content li:not(:contains(" + search_input.val().trim() + "))").hide();
            });
        });

        // 点击除了div之外的元素隐藏
        $(document).bind('click', function (e) {
            var e = e || window.event; //浏览器兼容性 
            var elem = e.target || e.srcElement;
            while (elem) { //循环判断至跟节点，防止点击的是div子元素 
                if (elem.id && elem.id == 'myDiv1') {
                    return;
                }
                elem = elem.parentNode;
            }
            $('.sewvbm').hide(); //点击的不是div或其子元素 
        }); 
        $("#jiazai").click(function(){
            var shu=$("#shuliang").val();
            $("#shuliang").val(shu*1+10);
            var d = {};
            var t = $('#formid').serializeArray();
            $.each(t, function() {
              d[this.name] = this.value;
            });
            var data=JSON.stringify(d);
            $.ajax({
                url:"{{url('order/chaxun')}}",
                type:'post', //GET
                async:false,    //或false,是否异步
                data:{'_token':'{{csrf_token()}}','data':data},
                dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                beforeSend:function(){
                    console.log('发送前');
                    $('.z2_loading-bg').show();
                },
                success:function(data){
                    var html="";
                    if(data=="false"){
                        location.reload(); 
                    }else{
                        $.each(data.order,function(i,item){
                            html+="<li class=\"gdlb_list gdlb_cjd\"><a href=\"jjj\"><p class=\"gdlb_tite\"><span class=\"gdlb_username fl\">"+item.customer+"<\/span><span class=\"gd_cjhs fr\">"+item.tai+"<\/span><span class=\"gd_cjzt fr\">"+item.dan+"<\/span><div class=\"cl\"><\/div><\/p><p class=\"gdlb_lylx\">"+item.type+"<\/p><p class=\"gdlb_xq\"><span class=\"gblb_xq1 fl\"><span>录入时间:<\/span><span class=\"gdlb_date\">"+item.order_orderdate+"<\/span><span class=\"gdlb_place\"> (<span>"+item.didian+"<\/span>)<\/span></span> <span class=\"gdlb_bq fr\">"+item.biaoqian+"<\/span><div class=\"cl\"><\/div><\/p><\/a><\/li>";
                    　　});
                        $("#shuliang").val(data.shuliang);
                        $("#orderlist").html(html);
                    }
                }, 
                complete:function(){
                    // window.location.reload();//刷新頁面
                    location.hash = 'gdgl1';
                    $("#gdgl1").show();
                    $("#gdgl2").hide();
                    $('.ym-tit').html('工单列表');
                    $('.z2_loading-bg').hide();
                    $('.duihao').show();
                    $('.duihao').hide(1000);
                }
            })
        })
    </script>
</html>